// Domien Nowicki
#include "QtAnimationGroupCommand.h"

QtAnimationGroupCommand::QtAnimationGroupCommand()
{
}

QtAnimationGroupCommand::QtAnimationGroupCommand(const QtAnimationGroupCommand& rhs)
{
	std::list<QtAnimationCommand*>::const_iterator it;

	for(it = rhs.commands.begin(); it != rhs.commands.end(); ++it)
	{
		QtAnimationCommand *command = (*it);

		commands.push_back( command->Clone() );
	}
}

QtAnimationGroupCommand::~QtAnimationGroupCommand()
{
	Clear();
}

void QtAnimationGroupCommand::Clear()
{
	std::list<QtAnimationCommand*>::iterator it;

	for(it = commands.begin(); it != commands.end(); ++it)
	{
		delete (*it);
	}

	commands.clear();
}

void QtAnimationGroupCommand::Execute()
{
	std::list<QtAnimationCommand*>::iterator it;

	for(it = commands.begin(); it != commands.end(); ++it)
	{
		(*it)->Execute();
	}
}

QtAnimationCommand* QtAnimationGroupCommand::Clone() const
{
	return new QtAnimationGroupCommand(*this);
}

void QtAnimationGroupCommand::AddCommand(QtAnimationCommand* command)
{
	commands.push_back( command->Clone() );
}


bool QtAnimationGroupCommand::Empty() const
{
	return commands.empty();
}
